#!/bin/bash

echo "===================================="
echo "  编译管理后台前端"
echo "===================================="
echo

cd admin-frontend

if [ ! -d "node_modules" ]; then
    echo "[提示] 安装依赖中..."
    pnpm install
    if [ $? -ne 0 ]; then
        echo "[错误] 依赖安装失败"
        exit 1
    fi
fi

echo "[信息] 开始编译..."
pnpm run build

if [ $? -eq 0 ]; then
    echo
    echo "[成功] 编译完成！输出目录: admin-frontend/dist"
else
    echo
    echo "[错误] 编译失败"
    exit 1
fi

cd ..

